package com.augrain.microframework.trace.instrument.web;

import com.augrain.microframework.trace.TraceProperty;
import jakarta.annotation.Resource;
import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * web配置类
 *
 * @author biaoy
 * @since 2021/08/20
 */
@Order(Ordered.HIGHEST_PRECEDENCE)
public class TraceWebConfig implements WebMvcConfigurer {

    @Resource
    private TraceProperty traceProperty;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new TraceWebLogInterceptor(traceProperty));
    }
}
